{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "6aa1548c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[[1, 2, 3, 3],\n",
       "        [1, 1, 1, 4]],\n",
       "\n",
       "       [[1, 2, 3, 3],\n",
       "        [1, 1, 1, 4]]])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "data = np.array([[[1,2,3,3],[1,1,1,4]],[[1,2,3,3],[1,1,1,4]]])\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "4fe16e62",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "shape:(2, 2, 4), dtype:int64, ndim:3, size:16, itemsize:8\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[[1, 2, 3, 3],\n",
       "        [1, 1, 1, 4]],\n",
       "\n",
       "       [[1, 2, 3, 3],\n",
       "        [1, 1, 1, 4]]], dtype=uint32)"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print(f\"shape:{data.shape}, dtype:{data.dtype}, ndim:{data.ndim}, size:{data.size}, itemsize:{data.itemsize}\")\n",
    "float_array = data.astype(dtype = \"u4\")\n",
    "float_array"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "id": "794e41e7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-3"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr2d = np.array([[1,2,3],[4,5,6],[7,8,9]])\n",
    "arr2d.shape\n",
    "~arr2d\n",
    "~2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "id": "991bb305",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "elm:[[1 2 3]\n",
      " [4 5 6]] shape:(2, 3), dtype:int64, ndim:2, size:6, itemsize:8\n"
     ]
    }
   ],
   "source": [
    "lower_dim_slice = arr2d[:2]\n",
    "print(f\"elm:{lower_dim_slice} shape:{lower_dim_slice.shape}, dtype:{lower_dim_slice.dtype}, ndim:{lower_dim_slice.ndim}, size:{lower_dim_slice.size}, itemsize:{lower_dim_slice.itemsize}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "fe2f7331",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(5,)"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr1d = np.array([1,2,3,4,5])\n",
    "arr1d.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "id": "d8f10b60",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([['a', 'a', 'a', 'a'],\n",
       "       ['b', 'b', 'b', 'b'],\n",
       "       ['c', 'c', 'c', 'c'],\n",
       "       ['d', 'd', 'd', 'd'],\n",
       "       ['e', 'e', 'e', 'e'],\n",
       "       ['f', 'f', 'f', 'f'],\n",
       "       ['g', 'g', 'g', 'g'],\n",
       "       ['h', 'h', 'h', 'h']], dtype='<U1')"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr = np.empty((8,4),dtype=np.str_)\n",
    "val_arr = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\n",
    "for i in range(8):\n",
    "    arr[i] = val_arr[i]\n",
    "arr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "24781423",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],\n",
       "       ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],\n",
       "       ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],\n",
       "       ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']], dtype='<U1')"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr.transpose()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "id": "73063a28",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 4,  7,  5,  6],\n",
       "       [20, 23, 21, 22],\n",
       "       [28, 31, 29, 30],\n",
       "       [ 8, 11,  9, 10]])"
      ]
     },
     "execution_count": 92,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr = np.arange(32).reshape((8,4))\n",
    "arr[[1,5,7,2]][:,[0,3,1,2]]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
